class OrdersInvoicesController < ApplicationController
  before_action :set_orders_invoice, only: [:show, :edit, :update, :destroy]

  respond_to :html

  def index
    @orders_invoices = OrdersInvoice.order(created_at: :desc).page(params[:page])
    respond_with(@orders_invoices)
  end

  def show
    respond_with(@orders_invoice)
  end

  def new
    @orders_invoice = OrdersInvoice.new
    respond_with(@orders_invoice)
  end

  def edit
  end

  def create
    @orders_invoice = OrdersInvoice.new(orders_invoice_params)
    @orders_invoice.save
    respond_with(@orders_invoice)
  end

  def update
    @orders_invoice.update(orders_invoice_params)
    respond_with(@orders_invoice)
  end

  def destroy
    @orders_invoice.destroy
    respond_with(@orders_invoice)
  end

  private
    def set_orders_invoice
      @orders_invoice = OrdersInvoice.find(params[:id])
    end

    def orders_invoice_params
      params[:orders_invoice]
    end
end
